import React, { Component } from 'react';
import CommunicationIn from './CommunicationIn';

export default class Communication extends Component {
  state = {
    value: 'default',
  }

  inputValue = (e) => {
    this.setState({
      value: e.target.value,
    })
  }

  cb = (value) => {
    this.setState({
      value,
    })
  }

  render() {
    return (
      <div>
        <p>父组件</p>
        <div>
          <input type="text" onChange={this.inputValue} value={this.state.value} />
        </div>
        <CommunicationIn
          value={this.state.value}
          cb={this.cb}
        />
      </div>
    )
  }
}